package cn.itcast.dao;

import cn.itcast.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * @Date :16:34 2021/6/13
 * @Author :xuhe
 */
@Repository
public interface UserDao {

    @Select("select * from user1 where userid=#{userid} and password=#{password}")
    public User findUser(@Param("userid") String userid, @Param("password") String password);

    @Insert("insert into user1(userid,password,username,email,images) values(#{userid},#{password},#{username},#{email},#{images})")
    public void saveUser(User user);

    @Update("update user1 set blogNumber=#{blogNumber} where userid=#{userid}")
    public void updateUser(User user);

    @Select("select * from user1 where userid=#{userid}")
    public User finUserByid(@Param("userid") String userid);

    @Update("update user1 set images=#{images}, password=#{password}, username=#{username}, email=#{email} where userid=#{userid}")
    public void updateUserinfo(User user);
}
